<title>价格模板</title>
<link rel="stylesheet" type="text/css" href="css/distri.css"/>
<link rel="stylesheet" type="text/css" href="css/jump.css"/>
<script type="text/javascript">
var ch=0;
function del(){//设置提交动作
	$("#act").val("del");
	oForm=document.forms[0];
	var x=oForm.getElementsByTagName("input");
	for(var i=0;i<x.length;i++){
		if(x[i].type=='checkbox'){
			if(x[i].checked){
				oForm.submit();
				break;
			}
		}
	}
}
function chAll(e){//(取消)全选
	var x=document.getElementsByTagName("input");
	for(var i=0;i<x.length;i++){
		var obj = x[i];
		if(obj.type=="checkbox"){
			if(e.checked)
				obj.checked=true;
			else
				obj.checked=false;
		}
	}  
}
function updTpl(){
	$("#act").val("rule");
	$(".sub_bun").submit();
	ch=0;
	return false;
}
window.onbeforeunload = leave; 
function leave(){
	if(ch){
		return "您对模板做了修改且尚未保存,是否不保存离开";
	}
}
</script>
<iframe name="ifr" style="display:none;"></iframe>
        <div class="r_content">
        	<h3 class="mc_title">
            	<span class="mctit_1"><span class="mctit_2">价格模板</span></span>
            </h3>
		  <form action="tpllist.php" target="ifr" class="sub_bun">
			<input type="hidden" name="act" id="act" />
            <table class="pritab">
            	<thead>
                	<th width="40"></th>
                	<th>模板名称</th>
                	<th width="300" class="txtcen">套用分销商</th>
                	<th width="220">备注（限30字）</th>
                </thead>
                <tbody>
				<?	foreach($t_sort as $list){?>
                	<tr>
                        <td class="txtcen"><input type="checkbox" name="list[]" value="<?=$list['id']?>"/></td>
                        <td><input type="text" class="intab" name="title[<?=$list['id']?>]" value="<?=$list['title']?>" /></td>
                        <td class="txtcen"><?=(int)$unum[$list['id']]?></td>
                        <td>
                            <input type="text" class="intab" name="note[<?=$list['id']?>]" value="<?=$list['note']?>"/>
                            <a href="addtpl.html?id=<?=$list['id']?>" class="inbtncon"><span>详细</span></a>
                        </td>
                    </tr>
				<?	}?>
                </tbody>
            </table>
        <!--<p class="gray">注：平台有新产品发布时，系统将按分销商所套用模板的<span class="red">「默认差价」</span>自动套用分销价格(四舍五入至元)。</p> -->
			<div class="martp5">
            	<input type="checkbox" class="allchek" onclick="chAll(this)"/>
                <a href="javascript:void(0)" onclick="if(confirm('删除后模板无法找回.确定删除?')){ch=0;del();}return false;" class="inbtncon"><span>删除</span></a>
                <a href="javascript:void(0)" onclick="updTpl()" class="inbtncon"><span>保存设置</span></a>
                <a href="addtpl.html" class="inbtncon"><span>新增模板</span></a>
            </div>
		  </form>
            <?page($total,$currentPage,$pageSize);?>
        </div>